package com.fqgj.xjd.user.common.enums;
public enum TaskTypeEnum {
    INIT(0, "初始化"),
    SUBMIT_VOTER_ID(1, "submit_voter_id"),
    QUERY_VOTER_ID(2, "query_voter_result"),
    SUBMIT_DRIVER_LICENSE(3, "submit_diver_license"),
    QUERY_DRIVER_LICENSE(4, "query_diver_license_result"),
    USER_AUTH_RISK(5, "user_auth_risk"),
    ;

    private int type;
    private String desc;

    TaskTypeEnum(int type, String desc) {
        this.type = type;
        this.desc = desc;
    }

    public int getType() {
        return type;
    }

    public TaskTypeEnum setType(int type) {
        this.type = type;
        return this;
    }

    public String getDesc() {
        return desc;
    }

    public TaskTypeEnum setDesc(String desc) {
        this.desc = desc;
        return this;
    }

    public static TaskTypeEnum getByType(int type) {
        TaskTypeEnum taskTypeEnum = null;
        for (TaskTypeEnum typeEnum : TaskTypeEnum.values()) {
            if (typeEnum.getType() == type) {
                taskTypeEnum = typeEnum;
                break;
            }
        }

        return taskTypeEnum;
    }

    /**
     * @see UserKycTypeEnum
     * DRIVER_LICENSE("3", "dl"), //dl
     * VOTER_ID("4", "voter"); //voter
     */
    public static TaskTypeEnum getType(String userKycType) {
        if ("3".equals(userKycType)) {
            return TaskTypeEnum.SUBMIT_DRIVER_LICENSE;
        }
        if ("4".equals(userKycType)) {
            return TaskTypeEnum.SUBMIT_VOTER_ID;
        }
        return null;

    }
}
